package cn.iocoder.yudao.module.shop.dal.mysql.itemtimesrecord;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.itemtimesrecord.ShopItemTimesRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.itemtimesrecord.vo.*;

/**
 * 项目次数变化记录 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopItemTimesRecordMapper extends BaseMapperX<ShopItemTimesRecordDO> {

    default PageResult<ShopItemTimesRecordDO> selectPage(ShopItemTimesRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopItemTimesRecordDO>()
                .eqIfPresent(ShopItemTimesRecordDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(ShopItemTimesRecordDO::getOptItemId, reqVO.getOptItemId())
                .likeIfPresent(ShopItemTimesRecordDO::getItemName, reqVO.getItemName())
                .betweenIfPresent(ShopItemTimesRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopItemTimesRecordDO::getId));
    }

    default List<ShopItemTimesRecordDO> selectList(ShopItemTimesRecordExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopItemTimesRecordDO>()
                .eqIfPresent(ShopItemTimesRecordDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(ShopItemTimesRecordDO::getOptItemId, reqVO.getOptItemId())
                .likeIfPresent(ShopItemTimesRecordDO::getItemName, reqVO.getItemName())
                .betweenIfPresent(ShopItemTimesRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopItemTimesRecordDO::getId));
    }

}
